def read1(input_file1, input_file2, input_file3):
    target = []
    opinion = []
    target1 = []
    lines = open(input_file1).readlines()
    for i in range(0, len(lines), 4):
        print(lines[i].strip())
        print(lines[i+1].strip())
        print(lines[i + 2].strip())
        print(type(lines[i + 3].strip()))
        # target.append(lines[i].strip().lower())

    # lines = open(input_file2).readlines()
    # for i in range(len(lines)):
    #     opinion.append(lines[i].strip().lower())
    #
    # lines = open(input_file3).readlines()
    # for i in range(len(lines)):
    #     target1.append(lines[i].strip().lower())
    return target, opinion, target1


def write(input_file1, input_file2, input_file3, output_file_1):
    target, opinion, target1 = read1(input_file1, input_file2, input_file3)
    m = []
    number = 0
    num = 0
    fp = open(output_file_1, 'w')
    for seg1 in range(len(target1)):
        for seg in range(len(target)):
            if target[seg] == target1[seg1] and seg >= number:
                m.append(opinion[seg])
                number = seg
                num += 1
                # print(target[seg])
                break
        if num == 0:
            number = seg1
            m.append(str(1))
        num = 0
    for seg in range(len(m)):
        fp.write(m[seg])
        fp.write("\n")


if __name__ == "__main__":
    file1 = 'data/14lap/train_1.txt'
    # file1 = 'data/tmp/14lap/target_train.txt'
    file2 = 'data/tmp/14lap/opinion_train.txt'
    file3 = 'data/14lap/generate_target_train.txt'
    # file4 = 'data/14lap/palority_train_1.txt'
    read1(file1, file2, file3)
    # write(file1, file2, file3, file4)
